import { Loading } from 'element-ui'
import '@/axios/index'
let comFunc = {
  ajaxReq (that, uri, data, success) {
    let loading = Loading.service({
      fullscreen: true,
      text: '拼命加载中...'
    })
    that.$http.post(uri, data).then(res => {
      loading.close()
      let response = res.data
      if (response.code === 0) {
        // let data = response.data
        success(response)
      } else {
        this.$message.error(response.msg)
      }
    }).catch(() => {
      loading.close()
      this.$message.error('服务器异常,请稍后重试')
    })
  }
}
export default comFunc
